'use strict'

let http =require('http');

let path=require('path');

let fs= require('fs');

let url = require('url');


//解析目录
let workDir=path.resolve('.');

console.log(workDir);

let server=http.createServer((req,res)=>{

    let reqPath=req.url;
    console.log(reqPath);

    res.write('<head><meta charset="utf8" /></head>');

    let filepath = path.join(workDir, reqPath);

    console.log(filepath);

  let files=  fs.readdirSync(filepath);

  console.log(files);

});

server.listen(6000);

console.log('服务器地址为:http://127.0.0.1:6000/');
